package com.utilities.IO.fileWriters;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;

import com.utilities.IO.FileUtilities;
import com.utilities.dataStructures.Range;
import com.utilities.parsers.MapperContigStats;

public class Test2 
{
	public static void main(String[] args) throws Exception
	{
//		MapperContigStats contigStats = new MapperContigStats(true, 
//				"C:/Users/bansalp/Desktop/DeNovo/DeNovo/7328/Mapped/454LargeContigs.fna", 
//				"C:/Users/bansalp/Desktop/DeNovo/DeNovo/7328/Mapped/scaffold.txt");
//		contigStats.main(null);
//		ArrayList<Range> contigs_gamma70 = FileUtilities.readFromFile("C:/Users/bansalp/Desktop/DeNovo/DeNovo/gamma70/mergedContigs.txt");
//		ArrayList<Range> contigs_singleReads = FileUtilities.readFromFile("C:/Users/bansalp/Desktop/DeNovo/DeNovo/singleEnds/mergedContigs.txt");
//		DeNovo2 deNovo2 = new DeNovo2();
//		deNovo2.makeVisualisation(contigs_singleReads, 4639675, null, contigs_gamma70);
		
//		ArrayList<Range> allGenes = FileUtilities.readFromFile("C:/Users/bansalp/Desktop/AllGenesPossible.out");
//		
//		TreeSet<String> genes = new TreeSet<String>();
//		BufferedReader bufferedReader = new BufferedReader(new FileReader("C:/Users/bansalp/Desktop/DeNovo/DeNovo/gamma70/allGenesFoundOnContigs.txt"));
//		String readLine = bufferedReader.readLine();
//		while(readLine != null)
//		{
//			String[] params = readLine.split("\t");
//			genes.add(params[params.length - 1]);
//			readLine = bufferedReader.readLine();
//		}
//		bufferedReader.close();
//		
//		Collections.sort(allGenes,new RangeComparator());
//		ArrayList<Range> visualisedList = new ArrayList<Range>();
//		for(Range gene : allGenes)
//		{
//			if (genes.contains(gene.getMetadata()))
//			{
//				genes.remove(gene.getMetadata());
//				Range range = new Range(gene.getLowerLimit(), gene.getUpperLimit(), gene.getMetadata());
//				visualisedList.add(range);
//			}
//		}
//		
//		ArrayList<Range> contigs_gamma70 = FileUtilities.readFromFile("C:/Users/bansalp/Desktop/DeNovo/DeNovo/gamma70/mergedContigs.txt");
//		DeNovo2 deNovo2 = new DeNovo2();
//		deNovo2.makeVisualisation(allGenes, 4639675, null, null);
		
		PrepareGFF3 gff3 = new PrepareGFF3().setInputFile("C:/Users/bansalp/Desktop/DeNovo/DeNovo/hits.txt")
		.setOutputFile("C:/Users/bansalp/Desktop/DeNovo/DeNovo/resultGff3_clean").
		setInputFile_gbk("C:/Users/bansalp/Desktop/gbkFile2.gbk").setSeqName("refSeq").makeGff3File();
		gff3.cleanGFF3File();
		ArrayList<Range> ranges = gff3.findRanges();
		TreeSet<String> set = new TreeSet<String>();
		for(Range range : ranges)
		{
			set.add(range.getMetadata());
		}
		System.out.println(set.size());
	}
}
